fix: add feature flag retry circuit breaker#247
Conversation
posthog-dotnet Compliance ReportDate: 2026-07-02 10:41:55 UTC ✅ All Tests Passed!16/16 tests passed Feature_Flags Tests✅ 16/16 tests passed View Details
|
|
@haacked wdyt about this circuit break approach? (we can also make the 30s configurable) |
|
Reviews (1): Last reviewed commit: "fix: add feature flag retry circuit brea..." | Re-trigger Greptile |
|
@marandaneto I meant to submit the review as a comment, not approval! But I trust you to do the right thing. 😄 |
thx for the review, yeah it was just a draft with a concept, will check and work on it on monday, then i can port this change across other sdks that have a similar situation |
|
i re-requested review to remove the approval, but no need to re-review until i address the comments and make it ready for review |
…y-circuit-breaker-20260626 # Conflicts: # src/PostHog/Api/PostHogApiClient.cs # src/PostHog/Library/HttpClientExtensions.cs # tests/UnitTests/Library/HttpClientExtensionsTests.cs
|
Reviews (2): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
|
@PostHog/team-client-libraries still pending here |
ioannisj
left a comment
There was a problem hiding this comment.
LG, left a couple of comments
…y-circuit-breaker-20260626
haacked
left a comment
There was a problem hiding this comment.
Nice work resolving the earlier feedback! A few more non-blocking suggestions inline.
|
will wait for people to upgrade/test/complain (hopefully not) this approach before i add to the sdk test harness/spec/port to other SDKs |
💡 Motivation and Context
Stacked on top of #245 to prototype a circuit breaker for
/flagsretry behavior in a multithreaded/stateless SDK.The existing retry is bounded per call, but during a broad connectivity issue many concurrent request threads can each sleep and retry independently. This adds a shared circuit breaker so repeated transient
/flagstransport failures put the SDK into a short cooldown and subsequent calls fail fast instead of all sleeping/retrying.💚 How did you test it?
dotnet test tests/UnitTests/UnitTests.csproj --filter FullyQualifiedName~HttpClientExtensionsTestsgit diff --check📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Implemented as a draft stacked PR for review. The circuit opens after consecutive transient
/flagsfailures, fails fast during cooldown, and allows a half-open probe after cooldown. HTTP/API status failures remain non-retryable and do not trip the transient-failure circuit.